<?php

/*
 * This file is part of the symfony package.
 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/**
 *
 * @package    symfony
 * @subpackage plugin
 * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
 * @version    SVN: $Id: sfGuardUser.php 7634 2008-02-27 18:01:40Z fabien $
 */
class sfGuardUser extends PluginsfGuardUser
{
	public function isInGroup($group_id){
		$groups = $this->getsfGuardUserGroups(); 
		
		if(count($groups)>0){
			foreach($groups as $group)
			if($group->getGroupId() == $group_id)
				return true;
		}
		return false; 
	}
	
	public function getGroup(){
		/* Get first group of user */
		$groups = $this->getsfGuardUserGroups();
		if(count($groups)>0){
			foreach($groups as $group){
				return sfGuardGroupPeer::retrieveByPk($group->getGroupId()); 
			}
		}
		else return null;
	}
}
